Future trait
Rustの標準ライブラリに含まれる
async fnはで返される型は自動的にFutureを実装される
code:rs
pub trait Future {
type Output;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>;
}
pub enum Poll<T> {
Ready(T),
Pending,
}
完了状態(値を返すか、エラーを返すか)をポーリング(poll)することで進行状況を確認できる。